package recursion;

public class Sum {
    static int f3(int[] arr, int begin) {
        if (begin == arr.length - 1) return arr[begin];
        return arr[begin] + f3(arr, begin + 1);
    }

    public static void main(String[] args) {
        int[] arr = {1, 2, 3, 4, 5, 6};
        System.out.println(f3(arr, 2));
    }
}
